package com.stx.friends.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.stx.friends.service.CommentService;

import com.stx.friends.vo.CommentVo;
 

public class CommentAction extends ActionSupport {

	private CommentService service ;
	HttpServletRequest request=ServletActionContext.getRequest();
	//信息列表
	private List<CommentVo> commentList = new ArrayList<CommentVo>();

	private CommentVo criteria=null;
	private CommentVo comment=null;
	private String wrxUid=null;
	
	

	public CommentService getService() {
		return service;
	}



	public String list() {

		setCommentList(service.list(new CommentVo()));

		return SUCCESS;
	}
	public String edit(){
		
		wrxUid=request.getParameter("wrxUid");
		comment=this.service.getCommentById(wrxUid);
		System.out.println(comment.getwrxUid());
		return SUCCESS;
	}
	public String update(){
		
		
		
		this.service.update(criteria);
		
		
		return SUCCESS;
	}
	public String del(){
		
		wrxUid=request.getParameter("wrxUid");
		service.delComment(wrxUid);
		System.out.println(wrxUid);
		return SUCCESS;
	}
	
	public CommentVo getCriteria() {
		return criteria;
	}



	public void setCriteria(CommentVo criteria) {
		this.criteria = criteria;
	}



	public CommentVo getComment() {
		return comment;
	}



	public void setComment(CommentVo comment) {
		this.comment = comment;
	}



	public String getwrxUid() {
		return wrxUid;
	}



	public void setwrxUid(String wrxUid) {
		this.wrxUid = wrxUid;
	}



	public String add(){
		
		service.addComment(comment);
		
		return SUCCESS;
	}

	public void setService(CommentService service) {
		this.service = service;
	}



	public List<CommentVo> getCommentList() {
		return commentList;
	}



	public void setCommentList(List<CommentVo> commentList) {
		this.commentList = commentList;
	}





}
